#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
    3.2获取测试数据内进行请求所需要的关键字段
    3.3进行requests请求，获得返回结果
'''
#导包
import requests



class ConfigHttp(object):
    def __init__(self, m, u, v):
        self.method = m
        self.url = u
        self.value = v

    def run(self):
        if self.method == 'get':
            re = self.__get()
            return re
        elif self.method == 'post':
            re = self.__post()
            return re

    def __get(self):
        re = requests.get(url=self.url, params=self.value)
        return re

    def __post(self):
        re = requests.post(url=self.url, data=self.value)
        return re


